# Pilot Endline Cleaning ------------------------------------------------------------

# This script implements cleaning by the IPA research assistant. Originally
# coded in Stata, it has been translated below into R.

# Clean variable names ----------------------------------------------------

names(el_pilot) <- gsub("consented.section_[1-9]\\.|consented.section_[1-9][0-9]\\.", 
									 "", 
									 names(el_pilot),fixed = FALSE)

names(el_pilot) <- gsub("\\.","", names(el_pilot))

names(el_pilot) <- gsub("gr[1-9]_[1-9]|gr[1-9][0-9]_[1-9]","", names(el_pilot))

# Code select_multiple variables into dummies -----------------------------

other_langs_split <- 
	el_pilot$other_lang_q2_24 %>% 
	strsplit(split = " ") 

other_langs <- 
	other_langs_split %>% 
	unlist() %>% unique() %>% as.numeric() %>% sort() %>% as.character()

for(i in other_langs){
	new_var <- paste0("other_lang_q2_24_", i)
	el_pilot[,new_var] <- sapply(other_langs_split, function(x) any(i %in% x) %>% as.numeric())
}

relationships_split <- 
	el_pilot$relationship_person_q18_2 %>% 
	strsplit(split = " ") 

relationships <- 
	relationships_split %>% 
	unlist() %>% unique() %>% as.numeric() %>% sort() %>% as.character()

for(i in relationships){
	new_var <- paste0("rel_q18_2_", i)
	el_pilot[,new_var] <- sapply(relationships_split, function(x) any(i %in% x) %>% as.numeric())
}


topics_split <- 
	el_pilot$convers_q3_3 %>% 
	strsplit(split = " ") 

topics <- 
	topics_split %>% 
	unlist() %>% unique() %>% as.numeric() %>% sort() %>% as.character()

for(i in topics){
	new_var <- paste0("convers_q3_3_", i)
	el_pilot[,new_var] <- sapply(topics_split, function(x) any(i %in% x) %>% as.numeric())
}


# Implementing manual cleaning by RA --------------------------------------

el_pilot <- 
	el_pilot %>% 
	# ** Drop trial observations
	# drop if consentedsection_1id==0
	filter(id != 0) %>% 
	# replace rand_sec12=1 if consentedsection_12gr12_1randomd <= 0.5
	# replace rand_sec12=2 if consentedsection_12gr12_1randomd > 0.5
	mutate(rand_sec12 = case_when(randomdraw6 <= 0.5 ~ 1, 
																randomdraw6 > 0.5 ~ 2), 
				 rand_q6_2a = randomdraw1,
				 rand_q6_2b = randomdraw2,
				 rand_q6_2c = randomdraw3,
				 rand_q9_1a = randomdraw4,
				 rand_q9_1b = randomdraw5,
				 rand_q12 = randomdraw6,
				 rand_q15_4 = randomdraw7,
				 rand_q15_5 = randomdraw8, 
				 audio_consent = audioaudio_consent, 
				 survey_consent = survey_consentconsent, 
				 rel_q2_4_ot = q2_4_oth,
				 status_q2_5_ot = q2_5_oth,
				 rel_parents_q2_17_ot = q2_17_oth,
				 rel_q18_2_10_ot = q18_2_oth,
				 rel_mother_q2_18_ot = q2_18_oth,
				 rel_father_q2_19_ot = q2_19_oth,
				 lang_q2_23_ot = q2_23_oth,
				 tribe_q2_25_ot = q2_25_oth,
				 activity_q3_1_ot = q3_1_oth,
				 relig_q14_1_ot = q14_1_oth,
				 dwell_q16_1_ot = q16_1_oth,
				 dwell_q16_1 = dwelling_q16_1, 
				 floor_q16_6_ot = q16_6_oth, 
				 light_q16_7_ot = q16_7_oth, 
				 fuel_q16_8_ot = q16_8_oth,
				 kitchen_q16_10_ot = q16_10_oth,
				 water_q16_11_ot = q16_11_oth,
				 walls_q16_5_ot = q16_5_oth,
				 id = case_when((id==113240 & KEY=="uuid:d1b0dcb7-3367-4e2c-b5b9-6e12eb09dc1d") ~ as.integer(113210),
				 							 (id==126234 & KEY=="uuid:43dcf256-446e-47e9-aae0-1a3d43e1a440") ~ as.integer(126230),
				 							 (id==112127 & KEY=="uuid:cbc44b7c-2a8d-43bb-8656-fd00b7f1f7e8") ~ as.integer(112227),
				 							 (id==125102 & KEY=="uuid:8aaccb96-6f78-49ed-a3a5-d5872b687cfd") ~ as.integer(125101),
				 							 (id==123456 & KEY=="uuid:23c2c1d8-4765-4843-b89c-be31f416ea97") ~ as.integer(128143),
				 							 (id==126315 & KEY=="uuid:af84a859-2cc6-4be4-90db-3ea3d2050c83") ~ as.integer(126336),
				 							 (id==112142 & KEY=="uuid:5a0fbad9-46ba-4264-8a03-b1d05f919369") ~ as.integer(112143),
				 							 (id==111209 & KEY=="uuid:1477fb49-b63d-43ac-ac3c-a7173f3d5cbe") ~ as.integer(111205),
				 							 (id==111240 & KEY=="uuid:fdf237ae-ca71-43c6-9d7e-a31a6bed28f6") ~ as.integer(111230),
				 							 (id==112232 & KEY=="uuid:4b2d17c3-75f8-4a01-a932-a66951cae6eb") ~ as.integer(112132),
				 							 (id==111111 & KEY=="uuid:77752b9e-342c-4951-a96b-151b248bab1e") ~ as.integer(112130),
				 							 (id==111111 & KEY=="uuid:231e0770-63f8-4520-a986-4d38fb1b9aea") ~ as.integer(317241),
				 							 (id==314225 & KEY=="uuid:25769c9b-e983-4d3c-8011-0eeb4c36dfc4") ~ as.integer(314210),
				 							 (id==318230 & KEY=="uuid:534b7daf-44a8-423e-a129-e4da16147da5") ~ as.integer(318238),
				 							 (id==318218 & KEY=="uuid:fc594dd6-9964-4229-9528-671c9a47cc0c") ~ as.integer(318214),
				 							 (id==318236 & KEY=="uuid:0e5d9d7d-cb7e-4cff-b92f-e4eb104058a1") ~ as.integer(318226),
				 							 (id==316116 & KEY=="uuid:d2a254dc-8276-4d56-8782-9a13e5dc6d87") ~ as.integer(316118),
				 							 (id==214527 & KEY=="uuid:deb8f432-5130-4595-a112-0a116558d952") ~ as.integer(214538),
				 							 (id==213405 & KEY=="uuid:708cf8b4-c331-4026-bcd7-53eaeba9eab1") ~ as.integer(213404),
				 							 (id==214518 & KEY=="uuid:1390083d-b02a-4a73-995e-656925889956") ~ as.integer(214521),
				 							 (id==215245 & KEY=="uuid:7bfeff50-2a0f-4cf5-b750-6338387af624") ~ as.integer(215216),
				 							 (id==212142 & KEY=="uuid:62aed76c-e7aa-469b-8473-89356f57641f") ~ as.integer(212144),
				 							 (id==217138 & KEY=="uuid:d3e4c72f-f297-44bb-9924-4511338783ef") ~ as.integer(217136),
				 							 (id==217338 & KEY=="uuid:29a3a29e-8c5d-4f08-ac38-95b3ec886764") ~ as.integer(217216),
				 							 (id==211112 & KEY=="uuid:76424a08-038e-4541-871e-7fcbbee8dad8") ~ as.integer(211102),
				 							 (id==111111 & KEY=="uuid:fdb29926-bdd4-4b59-b092-97430bcd775b") ~ as.integer(213109),
				 							 (id==215211 & KEY=="uuid:d1c8a221-7be4-4fb8-8713-08a47f8b12bd") ~ as.integer(215209),
				 							 (id==123456 & KEY=="uuid:a3327b57-132a-4b26-b47c-c5020ad91c00") ~ as.integer(113360),
				 							 (id==125267 & KEY=="uuid:6d4fed81-cbec-4229-881b-cc2ae2095d23") ~ as.integer(125268),
				 							 (id==213465 & KEY=="uuid:accc444b-1dc0-424d-a7f4-71b5959c742c") ~ as.integer(213464),
				 							 # forval i=51(1)70{
				 							 # replace id=3122`i' if id==2122`i'
				 							 # }
				 							 (id %in% paste0("2122",51:70)) ~ gsub("2122","3122", id) %>% as.integer(), 
				 							 TRUE ~ as.integer(id))) %>% 
	# drop if id==311132 & KEY=="uuid:9b468d00-e66e-4abc-9863-1362f97f4e71" // same interview appearing twice
	filter(!(id==311132 & KEY=="uuid:9b468d00-e66e-4abc-9863-1362f97f4e71")) %>% 
	# drop if id==214536 & KEY=="uuid:1e7f79eb-451c-4408-8f4b-545d5f7f38fb" // the first time the wrong person has been interviewed
	filter(!(id==214536 & KEY=="uuid:1e7f79eb-451c-4408-8f4b-545d5f7f38fb")) %>% 
	# drop if id==112243 // person already interviewed
	filter(!(id==112243)) %>% 
	mutate(
		# Fixing mistakes
		enum = case_when(( enum==30 & KEY=="uuid:45f75733-5aab-471e-b13e-3e703ad50cb4") ~ 8,
										 ( enum==23 & KEY=="uuid:e762b8dd-930c-4073-8f26-065ead8da8ef") ~ 28, 
										 ( enum==16 & KEY=="uuid:2628eda7-3d65-4a98-b867-d069bdc9da09") ~ 5, 
										 TRUE ~ as.numeric(enum)), 
		sex_q2_1 = case_when(( id==213313 & KEY=="uuid:5a2ad123-b8b9-49b7-a23b-e56290c3abb1") ~ 1 ,
												 TRUE ~ as.numeric(sex_q2_1)),
		rel_q2_4 = case_when(( rel_q2_4_ot=="Daughter in law" & KEY=="uuid:846e27a9-b48a-4ff8-bf09-aded628ad9df") ~ 4 ,
												 TRUE ~ as.numeric(rel_q2_4)),
		rel_q2_4_ot = case_when(( KEY=="uuid:846e27a9-b48a-4ff8-bf09-aded628ad9df") ~ "", 
														( rel_q2_4_ot=="Sept father" ) ~ "Step father", 
														( rel_q2_4_ot=="She is a  housemaid"|rel_q2_4_ot=="House maid"|rel_q2_4_ot=="House keeper") ~ "Worker" ,
														( rel_q2_4_ot=="Mulamu" & KEY=="uuid:f5c48dc6-185b-4529-b67f-78c636ea83e4") ~ "In law" ,
														TRUE ~ rel_q2_4_ot),
		rel_q2_4 = case_when(( rel_q2_4_ot=="Grand daughter" ) ~ 5, 
												 TRUE ~ rel_q2_4),
		rel_q2_4_ot = case_when(( rel_q2_4_ot=="Grand daughter" ) ~ "",
														TRUE ~ rel_q2_4_ot),
		status_q2_5 = case_when(( status_q2_5_ot=="Wife divorced" & KEY=="uuid:c7207c3d-3843-420d-947d-33bbb57df4e9") ~ 4 ,
														( status_q2_5_ot=="Wife separated but he has hopes of coming back" & KEY=="uuid:4696c62d-a2bc-4356-b8be-f4acc8078032") ~ 5 ,
														( status_q2_5_ot=="Wife died" & KEY=="uuid:dcf14770-f6d9-47cd-9d68-d5d9042e9dad") ~ 6 ,
														( status_q2_5_ot=="Daughter" & KEY=="uuid:6faf688b-bdba-4ef9-b97d-45f908bc0fc6") ~ 7 ,
														( KEY=="uuid:9d622968-9c06-4e71-beab-a31b89403993") ~ NA_real_,
														( status_q2_5_ot=="Not married just home" & KEY=="uuid:29d94973-6732-4694-88e5-803813a5e799") ~ 7 ,
														TRUE ~ as.numeric(status_q2_5)),
		status_q2_5_ot = case_when(( KEY=="uuid:c7207c3d-3843-420d-947d-33bbb57df4e9") ~ "" ,
															 ( KEY=="uuid:4696c62d-a2bc-4356-b8be-f4acc8078032") ~ "" ,
															 ( KEY=="uuid:dcf14770-f6d9-47cd-9d68-d5d9042e9dad") ~ "" ,
															 ( KEY=="uuid:6faf688b-bdba-4ef9-b97d-45f908bc0fc6") ~ "" ,
															 ( KEY=="uuid:9d622968-9c06-4e71-beab-a31b89403993") ~ "" ,
															 ( KEY=="uuid:29d94973-6732-4694-88e5-803813a5e799") ~ "" ,
															 TRUE ~ status_q2_5_ot),
		rel_parents_q2_17_ot = case_when(( rel_parents_q2_17_ot=="Had lost the dad and the mum"|rel_parents_q2_17_ot=="One of the parents has died"|rel_parents_q2_17_ot=="Mum had died when i was still young"|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Grew up with only dad"|rel_parents_q2_17_ot=="Lost the Father at 6 years"|rel_parents_q2_17_ot=="Mother had separated"|rel_parents_q2_17_ot=="The mother died when she was too young, she was only living with the father"|rel_parents_q2_17_ot=="The father died when she was young,she was only living with the mother"|rel_parents_q2_17_ot=="She was living with only the father and mother died when she was too young"|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Both parents had died"|rel_parents_q2_17_ot=="They had both died"|rel_parents_q2_17_ot=="Parents passed away when she was very young"|rel_parents_q2_17_ot=="All the parents had died"|rel_parents_q2_17_ot=="Mum and dadndied while I was still young"|rel_parents_q2_17_ot=="Both parents had died"|rel_parents_q2_17_ot=="Died"||rel_parents_q2_17_ot=="Patents where dead by then"|rel_parents_q2_17_ot=="Both parents had died"|rel_parents_q2_17_ot=="Mother and father died"|rel_parents_q2_17_ot=="They were dead"|rel_parents_q2_17_ot=="Parents were dead by then"|rel_parents_q2_17_ot=="Parents died when she was young"|rel_parents_q2_17_ot=="Both parents died when he was a baby"|rel_parents_q2_17_ot=="They both died while I was under 16 years"|rel_parents_q2_17_ot=="Lost both parents at age of 13"|rel_parents_q2_17_ot=="All parents had died"|rel_parents_q2_17_ot=="Both parents died when he was young"|rel_parents_q2_17_ot=="Died"|rel_parents_q2_17_ot=="Both parents died"|rel_parents_q2_17_ot=="She both parents when she was young"|rel_parents_q2_17_ot=="The both died while I was 3 years"|rel_parents_q2_17_ot=="The others parent had passed away"|rel_parents_q2_17_ot=="Parents were dead by then"|rel_parents_q2_17_ot=="They both passed away when I was so young."|rel_parents_q2_17_ot=="Both parents had died"|rel_parents_q2_17_ot=="They died when I was young"|rel_parents_q2_17_ot=="Mother and father died when she was young."|rel_parents_q2_17_ot=="The parents were both dead"|rel_parents_q2_17_ot=="Orphan"|rel_parents_q2_17_ot=="Died"|rel_parents_q2_17_ot=="Had died during war"|rel_parents_q2_17_ot=="Died"|rel_parents_q2_17_ot=="The parents died when he was 3years so he can't tell since he was so young"|rel_parents_q2_17_ot=="They died when one year old"|rel_parents_q2_17_ot=="Parents passed away she was young at 10years"|rel_parents_q2_17_ot=="Parents had died"|rel_parents_q2_17_ot=="They passed away when he was still young"|rel_parents_q2_17_ot=="Mum and dad died while still a baby"|rel_parents_q2_17_ot=="We're dead"|rel_parents_q2_17_ot=="All parents died when she was aged 3 years"|rel_parents_q2_17_ot=="Parents had died"|rel_parents_q2_17_ot=="My parents died when I was still young") ~ "Parents have died" ,
																		 ( rel_parents_q2_17_ot=="The dad died when i was still a baby"|rel_parents_q2_17_ot=="Mum had died"|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Dad had passed on"|rel_parents_q2_17_ot=="Had lost the mum"|rel_parents_q2_17_ot=="One parent had died"|rel_parents_q2_17_ot=="Has only the mother"|rel_parents_q2_17_ot=="Dad passed on when he was young"|rel_parents_q2_17_ot=="Mum died wen I was around 15 years"|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Dad passed on before he was born"|rel_parents_q2_17_ot=="Dad died when he was 2years"|rel_parents_q2_17_ot=="Mother died while still young"|rel_parents_q2_17_ot=="One parent had died"|rel_parents_q2_17_ot=="Has only the mother"|rel_parents_q2_17_ot=="One parent had died"|rel_parents_q2_17_ot=="She was not living with the both parents ,mum died when she was young and she left the father when she was 10 years"|rel_parents_q2_17_ot=="I lived with only my mother because my  father died when i was too young"|rel_parents_q2_17_ot=="Dad had died by that time"|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Dad had died by that time"|rel_parents_q2_17_ot=="Dad passed away when I was younger"|rel_parents_q2_17_ot=="Dad died while I was still young and mum when she had just given birth to me"|rel_parents_q2_17_ot=="Lost Father when she was still young") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="dad was dead"|rel_parents_q2_17_ot=="Mom passed on when she was young"|rel_parents_q2_17_ot=="Dad died when she was 10 years"|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Had lost the dad"|rel_parents_q2_17_ot=="She lost the Father at age of three"|rel_parents_q2_17_ot=="Had only the mum"|rel_parents_q2_17_ot=="Mum had died"|rel_parents_q2_17_ot=="The mum passed away  a early age that he didn't know"|rel_parents_q2_17_ot=="Dad died when I was younger."|rel_parents_q2_17_ot=="Father died when she was two"|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Lost the mother at 2 years"|rel_parents_q2_17_ot=="She was only living with her father,the mother died when she was young"|rel_parents_q2_17_ot=="The dad passed on"|rel_parents_q2_17_ot=="The dad passed on when she was young"|rel_parents_q2_17_ot=="The father had died"|rel_parents_q2_17_ot=="Mother died when he was 7years old") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Father died when she was still young"|rel_parents_q2_17_ot=="Mum had died"|rel_parents_q2_17_ot=="Mum died while I was 6 and dad while I was about 14"|rel_parents_q2_17_ot=="Father died when he was young"|rel_parents_q2_17_ot=="Lost the Father at age of 3"|rel_parents_q2_17_ot=="Mother had died"|rel_parents_q2_17_ot=="Dad had died by that time"|rel_parents_q2_17_ot=="Dad passed away when I was 10years but they where close with mom."|rel_parents_q2_17_ot=="Was with one parent"|rel_parents_q2_17_ot=="Mother died while still young"|rel_parents_q2_17_ot=="Dad passed on when I was 7years."|rel_parents_q2_17_ot=="Dad died when I was 6years old."|rel_parents_q2_17_ot=="Dad had died"|rel_parents_q2_17_ot=="Mother died while still young"|rel_parents_q2_17_ot=="Mum had died"|rel_parents_q2_17_ot=="Father died while still young"|rel_parents_q2_17_ot=="The respondent was only living with the mother,the father died when she was too young"|rel_parents_q2_17_ot=="Had lost the dad"|rel_parents_q2_17_ot=="Dad had died"|rel_parents_q2_17_ot=="dad died wen still very young"|rel_parents_q2_17_ot=="Mother died when he was a baby"|rel_parents_q2_17_ot=="Lost the mother at age 11"|rel_parents_q2_17_ot=="Show lost the father at 4months"|rel_parents_q2_17_ot=="Lost the mother atb10 yeÃ rs"|rel_parents_q2_17_ot=="Lost the Father at age of 12"|rel_parents_q2_17_ot=="The dad was dead"|rel_parents_q2_17_ot=="Mum had died"|rel_parents_q2_17_ot=="Dad died before I made a year on earth."|rel_parents_q2_17_ot=="Dad passed away when I was younger."|rel_parents_q2_17_ot=="Father died while still young"|rel_parents_q2_17_ot=="Dad passed away when I was a baby."|rel_parents_q2_17_ot=="Father had died"|rel_parents_q2_17_ot=="Died while still young"|rel_parents_q2_17_ot=="Lost the father at age of 2"|rel_parents_q2_17_ot=="Mother passed on when she was 11 years"|rel_parents_q2_17_ot=="dad was dead by that time") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Mum had died"|rel_parents_q2_17_ot=="Dad had died"|rel_parents_q2_17_ot=="Dad had died"|rel_parents_q2_17_ot=="Dad had died by that time"|rel_parents_q2_17_ot=="Mother had died"|rel_parents_q2_17_ot=="Father died when he was 13years old"|rel_parents_q2_17_ot=="Mother passed away when she was 7 years"|rel_parents_q2_17_ot=="Mum had died"|rel_parents_q2_17_ot=="The respondent was only living with the mother because the father died before she was sixteen years"|rel_parents_q2_17_ot=="Had lost the dad"|rel_parents_q2_17_ot=="His dad died when he was still young"|rel_parents_q2_17_ot=="Father died when he was 2years old"|rel_parents_q2_17_ot=="Lost the Father at age of 14") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Has only the father"|rel_parents_q2_17_ot=="The other parent had passed away"|rel_parents_q2_17_ot=="The others parent was dead"|rel_parents_q2_17_ot=="Parents died when he was 3years"|rel_parents_q2_17_ot=="Father was dead") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Father had divorced"|rel_parents_q2_17_ot=="Mother had divorced"|rel_parents_q2_17_ot=="Never grew with dad"|rel_parents_q2_17_ot=="Never grew up with real patents"|rel_parents_q2_17_ot=="The respondent has never lived with both parents"|rel_parents_q2_17_ot=="Father had divorced"|rel_parents_q2_17_ot=="They were separated"|rel_parents_q2_17_ot=="Parents were separated"|rel_parents_q2_17_ot=="Mum had separated"|rel_parents_q2_17_ot=="Parents separated during the war"|rel_parents_q2_17_ot=="Her parents separated when she was young she was brought up by her mother."|rel_parents_q2_17_ot=="Divorced"|rel_parents_q2_17_ot=="Mum had divorced"|rel_parents_q2_17_ot=="Mum and dad had divorced"|rel_parents_q2_17_ot=="They separated when she was a baby."|rel_parents_q2_17_ot=="Mother left fathers home when she was three month old."|rel_parents_q2_17_ot=="The respondent  only lived with the mother ,she didn't live with the father because they divorced"|rel_parents_q2_17_ot=="All parents had divorced"|rel_parents_q2_17_ot=="Parents separated when he was still young") ~ "Parents separated or divorced" ,
																		 ( rel_parents_q2_17_ot=="Didn't grow up with my parents"|rel_parents_q2_17_ot=="The respondent wasn't living with both parents she was living with the grand parents"|rel_parents_q2_17_ot=="Grew up with grandmother"|rel_parents_q2_17_ot=="Didn't grow up with both parents"|rel_parents_q2_17_ot=="Didn't grow up with parents from childhood."|rel_parents_q2_17_ot=="Didn't grow with both parents") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="Didn't grow with both parents"|rel_parents_q2_17_ot=="Didn't grow up with the both parents"|rel_parents_q2_17_ot=="Didn't see my parents"|rel_parents_q2_17_ot=="She never stayed with them"|rel_parents_q2_17_ot=="Was leaving with mum and stepfather"|rel_parents_q2_17_ot=="Grew up with the grandmother"|rel_parents_q2_17_ot=="Did not grow up with both parents") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="She has never met the dad since birth"|rel_parents_q2_17_ot=="Was not leaving with both parents"|rel_parents_q2_17_ot=="Didn't grow up with both parents"|rel_parents_q2_17_ot=="Didn't grow up with both parents"|rel_parents_q2_17_ot=="Was not with the parents"|rel_parents_q2_17_ot=="She wasn't living with both parents"|rel_parents_q2_17_ot=="Was not living with her parents") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="Was not leaving with parents"|rel_parents_q2_17_ot=="She wasn't living with both parents"|rel_parents_q2_17_ot=="I was living with only my father and I was not living with my mother"|rel_parents_q2_17_ot=="Was raised by his aunt"|rel_parents_q2_17_ot=="Grew up with my aunt"|rel_parents_q2_17_ot=="Didn't grow up with mum"|rel_parents_q2_17_ot=="Never grew up with parents"|rel_parents_q2_17_ot=="The respondent only lived with the father,she stopped living with the mother at the age of three years"|rel_parents_q2_17_ot=="She grow up with grandmother"|rel_parents_q2_17_ot=="Never leaved with both parents"|rel_parents_q2_17_ot=="Grew up with the grandparents"|rel_parents_q2_17_ot=="Grew up with the brothers") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="Mother and father never married or even lived together."|rel_parents_q2_17_ot=="The respondent has never lived with her parents"|rel_parents_q2_17_ot=="Wasn't leaving with the parents"|rel_parents_q2_17_ot=="Was not living with both parents"|rel_parents_q2_17_ot=="The respondent was only living with the father ,the mother left home when she was too young"|rel_parents_q2_17_ot=="Did not grow up with both parents"|rel_parents_q2_17_ot=="Didnot grow up with both parents"|rel_parents_q2_17_ot=="The respondent  has never lived with  any of her parent") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="She was brought up by her grandmother from the age of one year."|rel_parents_q2_17_ot=="Didn't grow up with both parents"|rel_parents_q2_17_ot=="Grew up with the brother"|rel_parents_q2_17_ot=="Grew up with only the father") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="She grew up with a relative"|rel_parents_q2_17_ot=="I was only living with my father"|rel_parents_q2_17_ot=="She grew up with her grandmother all her childhood."|rel_parents_q2_17_ot=="Didn't grow up with both parents"|rel_parents_q2_17_ot=="Mother was not leaving with them") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="Mum passed away when I was 7yrs."|rel_parents_q2_17_ot=="Mother died when he was still young"|rel_parents_q2_17_ot=="She grew up with her dad because parents had separeted"|rel_parents_q2_17_ot=="Parents have died"|rel_parents_q2_17_ot=="He is an orphan"|rel_parents_q2_17_ot=="Had lost both parents"|rel_parents_q2_17_ot=="they were dead by that time"|rel_parents_q2_17_ot=="they were dead") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Dad died when she was one year old"| rel_parents_q2_17_ot=="Parents separated when he was 4 years"|rel_parents_q2_17_ot=="Parents separated when he was young"|rel_parents_q2_17_ot=="She never met her dad. He never stayed with them") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Dad died while I was still very young"|rel_parents_q2_17_ot=="Both parents died in the war when he was young"| rel_parents_q2_17_ot=="dad was already dead"|rel_parents_q2_17_ot=="Dad passed away when I was 7years.") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="They died when she was young"|rel_parents_q2_17_ot=="Died when was still young"|rel_parents_q2_17_ot=="Both parents had died by that time"|rel_parents_q2_17_ot=="Deceased"|rel_parents_q2_17_ot=="They where dead"|rel_parents_q2_17_ot=="Both my parents passed away when I was less than 4 years old."|rel_parents_q2_17_ot=="They died in the war.. She never even met them"|rel_parents_q2_17_ot=="Both parents had passed on") ~ "Parents have died" ,
																		 ( rel_parents_q2_17_ot=="Mum died"|rel_parents_q2_17_ot=="Dad died when I was 10years"|rel_parents_q2_17_ot=="Father died when he was 6years old"|rel_parents_q2_17_ot=="Father died when he was very young"|rel_parents_q2_17_ot=="Father died when he was 7years old"|rel_parents_q2_17_ot=="The father of the respondent died when she was too young and she stopped living with her mother at the age of nine years"|rel_parents_q2_17_ot=="Dad died when she was about 9 years") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Dad died when I was 10 years"|rel_parents_q2_17_ot=="Father had had died"|rel_parents_q2_17_ot=="Has only the dad"|rel_parents_q2_17_ot=="The dad had died"||rel_parents_q2_17_ot=="The respondent's father died  when she was too young and she has never lived with her mother"|rel_parents_q2_17_ot=="Grew up with mDad passed away when I was 7years.") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Grew up with mum alone"| rel_parents_q2_17_ot=="um alone"|rel_parents_q2_17_ot=="Was living with my dad only"|rel_parents_q2_17_ot=="Grow up with my uncle"|rel_parents_q2_17_ot=="Never grew up with them"|rel_parents_q2_17_ot=="The respondent only lived with the father,she stopped living with the mother at the  age of two years"|rel_parents_q2_17_ot=="The respondent was living with only the mother ,she stopped living with the father when she was 10 years") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="The respondent only lived with her parents when she was four years"|rel_parents_q2_17_ot=="Never stayed with her parents"|rel_parents_q2_17_ot=="Grew up with a single parent"|rel_parents_q2_17_ot=="Grow up with my aunt"|rel_parents_q2_17_ot=="She started staying with grandmum from age of three years."|rel_parents_q2_17_ot=="She was brought up by her grandfather from the age of three years."|rel_parents_q2_17_ot=="Didn't grow with them"|rel_parents_q2_17_ot=="Was raised by grandparents"|rel_parents_q2_17_ot=="Grew up with the Aunt") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="Dad had divorced"|rel_parents_q2_17_ot=="Dad had divoeced"|rel_parents_q2_17_ot=="They separated when he was young") ~ "Parents separated or divorced" ,
																		 ( rel_parents_q2_17_ot=="Father died when she was 1 year"|rel_parents_q2_17_ot=="Father died when she was only five years"|rel_parents_q2_17_ot=="Father died in war"|rel_parents_q2_17_ot=="The dad died when young"|rel_parents_q2_17_ot=="Mother was dead by then"|rel_parents_q2_17_ot=="The respondent was living with only the mother ,the father died when she was too young") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Was raised was by his grand mum"|rel_parents_q2_17_ot=="Never grew with  Parents"|rel_parents_q2_17_ot=="Never saw mum"|rel_parents_q2_17_ot=="She grew up with grandmum from age of two."|rel_parents_q2_17_ot=="She lived with her grandmother from age of six years."|rel_parents_q2_17_ot=="The mom left when she was 2 years old"|rel_parents_q2_17_ot=="Doesn't know her mother"|rel_parents_q2_17_ot=="The respondent lived with only her mother ,she stopped living with the father when she was two years"|rel_parents_q2_17_ot=="The respondent was living with only the mother ,the father died when she was too young"|rel_parents_q2_17_ot=="Grew up only with the mum"|rel_parents_q2_17_ot=="Stayed with only the dad") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="Father died when she was 2 years"|rel_parents_q2_17_ot=="Mum died while she was 3 years"|rel_parents_q2_17_ot=="His dad died when he was very young"|rel_parents_q2_17_ot=="Father died when he was 2 years"|rel_parents_q2_17_ot=="The father died") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Mother left when she was a baby"|rel_parents_q2_17_ot=="Was staying with grandparents"|rel_parents_q2_17_ot=="Grew up with asingle mother"|rel_parents_q2_17_ot=="The respondent only lived with the mother she stopped living with the father when she was too young") ~ "Didn't grow up with parents" ,
																		 ( rel_parents_q2_17_ot=="Both parents died when the respondent is still young"|rel_parents_q2_17_ot=="Both parents of the respondent died when she was 10 years") ~ "Parents have died" ,
																		 ( rel_parents_q2_17_ot=="The respondent's father died when she  was too young at five years but the mother is still living"|rel_parents_q2_17_ot=="The father of the respondent died before she was born,she was living with only the mother"|rel_parents_q2_17_ot=="Dad died when he was two years old"|rel_parents_q2_17_ot=="Father died when he was a baby"|rel_parents_q2_17_ot=="Lost both parents at early age"|rel_parents_q2_17_ot=="Lost both parents before 16"|rel_parents_q2_17_ot=="Mum died while I was about 2 years"|rel_parents_q2_17_ot=="Dad died while I was about 8 years"|rel_parents_q2_17_ot=="Father died when she was 9years"|rel_parents_q2_17_ot=="The father died when she was 12 years") ~ "One parent has died" ,
																		 ( rel_parents_q2_17_ot=="Lost both parents at early age"|rel_parents_q2_17_ot=="Lost both parents before 16"|rel_parents_q2_17_ot=="Both of them Died"|rel_parents_q2_17_ot=="They died before I was 10 years of age"|rel_parents_q2_17_ot=="He's an orphan") ~ "Parents have died",
																		 TRUE ~ rel_parents_q2_17_ot),
		rel_parents_q2_17_ot = case_when(rel_parents_q2_17_ot=="Was married by then"|rel_parents_q2_17_ot=="Grew up with a step mother"|rel_parents_q2_17_ot=="Dad died when he was still young"|rel_parents_q2_17_ot=="She grew up with father"          ~"Didn't grow up with parents" ,
																		 rel_parents_q2_17_ot=="Separated when he was a baby"|rel_parents_q2_17_ot=="The parents separated when she was an infant She actually does not know the mother"          ~"Parents separated or divorced" ,
																		 rel_parents_q2_17_ot=="The respondent  wasn't living with both  parents she was living with her aunt from when she was four years"|rel_parents_q2_17_ot=="The dad had passed away"|rel_parents_q2_17_ot=="Father died when she was one year old"|rel_parents_q2_17_ot=="The father of the respondent died when she was too young at 5 years so she was living with the mother"|rel_parents_q2_17_ot=="Never met my dad"|rel_parents_q2_17_ot=="Grew up with grand parents ,her mother separated with her father when still young"|rel_parents_q2_17_ot=="Was already married"|rel_parents_q2_17_ot=="Was raised by dad"|rel_parents_q2_17_ot=="Didn't grow with both parents. He grew with grandmother."          ~"Didn't grow up with parents" ,
																		 rel_parents_q2_17_ot=="Lost the mother age early age"|rel_parents_q2_17_ot=="Mother died when he was 8months"|rel_parents_q2_17_ot=="Dad had died when he was still young"|rel_parents_q2_17_ot=="Father died when she was 3 years"|rel_parents_q2_17_ot=="Dad died while I was about 3 years"|rel_parents_q2_17_ot=="The respondent's parents were not saying together she was only staying with her father ,she lost her mother  at the age of nine years"|rel_parents_q2_17_ot=="Mother died when he was 1 year old"|rel_parents_q2_17_ot=="Mother died when he was 14years old"|rel_parents_q2_17_ot=="Father died when he was 15years old"|rel_parents_q2_17_ot=="Mother died when he was 15years old"|rel_parents_q2_17_ot=="Mother left when he was 4 months old"|rel_parents_q2_17_ot=="Dad died during the war"|rel_parents_q2_17_ot=="Father died when he was 8years old"|rel_parents_q2_17_ot=="Never saw my ADA. He died."          ~"One parent has died" ,
																		 rel_parents_q2_17_ot=="Grew up the mom"|rel_parents_q2_17_ot=="Was raised by his dad"|rel_parents_q2_17_ot=="She was only with the dad"|rel_parents_q2_17_ot=="They had died by then"|rel_parents_q2_17_ot=="Parents died when he was a baby"|rel_parents_q2_17_ot=="Was married already"|rel_parents_q2_17_ot=="The respondent's parents where not living together,the respondent was only living with her mother she was not living with the father"|rel_parents_q2_17_ot=="The respondents parents were not living together,she stopped living with both parents when she was eight years"|rel_parents_q2_17_ot=="Was raised by grandma"|rel_parents_q2_17_ot=="He was staying with only the mother"|rel_parents_q2_17_ot=="Grew up with only the mum"|rel_parents_q2_17_ot=="Raised by mum"          ~"Didn't grow up with parents" ,
																		 TRUE ~ rel_parents_q2_17_ot),
		rel_mother_q2_18_ot = case_when(rel_mother_q2_18_ot=="Mother was already dead"|rel_mother_q2_18_ot=="Patents where dead by then"|rel_mother_q2_18_ot=="Parents died while still young"|rel_mother_q2_18_ot=="Mum died while giving birth"|rel_mother_q2_18_ot=="Had died"|rel_mother_q2_18_ot=="Parents had  died"|rel_mother_q2_18_ot=="Mother was dead"|rel_mother_q2_18_ot=="Mum was dead by then"|rel_mother_q2_18_ot=="Mum died when I was a baby."||rel_mother_q2_18_ot=="Mother died when she was 3 years"|rel_mother_q2_18_ot=="he mother died when she was too young"|rel_mother_q2_18_ot=="Lost the mother at 2years"|rel_mother_q2_18_ot=="Parents died when she was younger than 10years"|rel_mother_q2_18_ot=="She had died"|rel_mother_q2_18_ot=="She was dead"|rel_mother_q2_18_ot=="Mum had died"|rel_mother_q2_18_ot=="She had died"|rel_mother_q2_18_ot=="All parents had died"|rel_mother_q2_18_ot=="The Mother died when she was young"|rel_mother_q2_18_ot=="Mother died when she was six years"|rel_mother_q2_18_ot=="Mum had died"|rel_mother_q2_18_ot=="Had lost the mum"|rel_mother_q2_18_ot=="Dad died while I was still young"|rel_mother_q2_18_ot=="She passed away when Florence was very young"|rel_mother_q2_18_ot=="Mum was died by that time"|rel_mother_q2_18_ot=="She was dead by that time"|rel_mother_q2_18_ot=="The mother died when she was still young"|rel_mother_q2_18_ot=="She died when she was very young"|rel_mother_q2_18_ot=="The mother died she was too young"|rel_mother_q2_18_ot=="The mother died when she was too young"|rel_mother_q2_18_ot=="Mother had died"|rel_mother_q2_18_ot=="The mother died  when she was too young(seven mother)"|rel_mother_q2_18_ot=="Parents died when i was still young"|rel_mother_q2_18_ot=="Parents had died"|rel_mother_q2_18_ot=="Mother died while still young"|rel_mother_q2_18_ot=="All parents had died"|rel_mother_q2_18_ot=="All parents has died"          ~"Mother had died" ,
																		rel_mother_q2_18_ot=="Mum had died"|rel_mother_q2_18_ot=="Mum died at the age of 6"|rel_mother_q2_18_ot=="Mum passed away at my tender age"|rel_mother_q2_18_ot=="Lost the mother at age 11"|rel_mother_q2_18_ot=="Passed away when I was so young."|rel_mother_q2_18_ot=="The mother of the respondent died when she was still young"|rel_mother_q2_18_ot=="She was dead"|rel_mother_q2_18_ot=="Mother had died"|rel_mother_q2_18_ot=="Mum had died"|rel_mother_q2_18_ot=="Died"|rel_mother_q2_18_ot=="Lost the mother at 13 age"|rel_mother_q2_18_ot=="Lost the mother at10 years"|rel_mother_q2_18_ot=="Deceased"|rel_mother_q2_18_ot=="Had died"|rel_mother_q2_18_ot=="Deceased"|rel_mother_q2_18_ot=="Parents were dead by then"|rel_mother_q2_18_ot=="They died when i was young"|rel_mother_q2_18_ot=="Mum died while I was a baby"|rel_mother_q2_18_ot=="Mother died"|rel_mother_q2_18_ot=="Mom passed on"|rel_mother_q2_18_ot=="Didn't grow with the mother. She died when he was young"|rel_mother_q2_18_ot=="Mum had died"|rel_mother_q2_18_ot=="She had died by that time"|rel_mother_q2_18_ot=="His mum died when he was young"|rel_mother_q2_18_ot=="Died when still young"|rel_mother_q2_18_ot=="Was dead"|rel_mother_q2_18_ot=="Orphan"|rel_mother_q2_18_ot=="Mother died while still young"|rel_mother_q2_18_ot=="Mother died when she was 10years"|rel_mother_q2_18_ot=="She passes on before she was 16 years"|rel_mother_q2_18_ot=="Mother died when she was seven years"|rel_mother_q2_18_ot=="Mum died when I was 8 years"|rel_mother_q2_18_ot=="Wasn't living with the mother"|rel_mother_q2_18_ot=="Did not grow up with the mother"|rel_mother_q2_18_ot=="Didn't grow up with mum"|rel_mother_q2_18_ot=="Didn't grow up with the mother"|rel_mother_q2_18_ot=="I wasn't living with my mum,I lived with only my father"|rel_mother_q2_18_ot=="Grew up with dad"          ~"Mother had died" ,
																		rel_mother_q2_18_ot=="MHad a foster mother"|rel_mother_q2_18_ot=="She did not grow up with her parents but with grand parents."|rel_mother_q2_18_ot=="Was not with the parents"|rel_mother_q2_18_ot=="Was not leaving with the mother"|rel_mother_q2_18_ot=="Wasn't leaving with the motherother had separated"          ~"Mother had died" ,
																		rel_mother_q2_18_ot=="She wasn't living with her mother"|rel_mother_q2_18_ot=="Wasn't leaving her"|rel_mother_q2_18_ot=="I wasn't living with my mother"|rel_mother_q2_18_ot=="Didn't grow up with my parents"|rel_mother_q2_18_ot=="Mum had divorced"|rel_mother_q2_18_ot=="She never grew up with the mother"|rel_mother_q2_18_ot=="She grow up with her grandmother because her mother got ill and left her got her self another husband."|rel_mother_q2_18_ot=="Mother left her when she was three month old."|rel_mother_q2_18_ot=="She wasn't living with the mother,she was living with grand parents"|rel_mother_q2_18_ot=="She wasn't living with the mother"|rel_mother_q2_18_ot=="She grew up with grandmother all her childhood."|rel_mother_q2_18_ot=="Need leaved with the mum"|rel_mother_q2_18_ot=="Mother had divorced"|rel_mother_q2_18_ot=="Didn't grow up with the mother"|rel_mother_q2_18_ot=="Didn't grow with mother"|rel_mother_q2_18_ot=="The respondent  has never lived with her mother"|rel_mother_q2_18_ot=="Grew up with the brother"|rel_mother_q2_18_ot=="Didn't grow up with the mother"|rel_mother_q2_18_ot=="She grew up with her grandmum"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="She was brought up by her grand mother."|rel_mother_q2_18_ot=="Divorced"|rel_mother_q2_18_ot=="Mum had separated"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="Grew up with the grandmother"|rel_mother_q2_18_ot=="Didn't grow up with the mother"|rel_mother_q2_18_ot=="Didn't grow up with the mother"|rel_mother_q2_18_ot=="No, didn't with the mother"|rel_mother_q2_18_ot=="Didn't grow with her"|rel_mother_q2_18_ot=="Didn't see her parents"|rel_mother_q2_18_ot=="Was leaving with mum and stepfather"|rel_mother_q2_18_ot=="She has never met the mom"|rel_mother_q2_18_ot=="Didn't grow with her"|rel_mother_q2_18_ot=="She did not grow up with her mother."|rel_mother_q2_18_ot=="Grew up with aunt"|rel_mother_q2_18_ot=="Mum had divorced"|rel_mother_q2_18_ot=="Never been with mum"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="Mum passed away when I was 7years."|rel_mother_q2_18_ot=="Mother had died by that time"|rel_mother_q2_18_ot=="He is an orphan"|rel_mother_q2_18_ot=="Mum died"|rel_mother_q2_18_ot=="Died while young"|rel_mother_q2_18_ot=="She passed away when I was less than a year old."          ~"Mother had died" ,
																		rel_mother_q2_18_ot=="Had a foster mother"|rel_mother_q2_18_ot=="Wasn't leaving with the mother"|rel_mother_q2_18_ot=="Mother had separated"|rel_mother_q2_18_ot=="The respondent stopped living with her parents at the age of four years"|rel_mother_q2_18_ot=="She grew up with dad"|rel_mother_q2_18_ot=="Didn't grow with the mother"|rel_mother_q2_18_ot=="Raised by grandma"|rel_mother_q2_18_ot=="Mother left her as an infant"|rel_mother_q2_18_ot=="Grow with with aunt"|rel_mother_q2_18_ot=="Was leaving with dad only"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="Grow up with my uncle"|rel_mother_q2_18_ot=="Didn't grow with the mother"|rel_mother_q2_18_ot=="She grew up with her step mother"|rel_mother_q2_18_ot=="She stayed with her grandmother."|rel_mother_q2_18_ot=="Didn't grow up with my mother"|rel_mother_q2_18_ot=="Grew up with grandfather"|rel_mother_q2_18_ot=="Didn't grow up with her"|rel_mother_q2_18_ot=="The respondent wasn't living with the mother she was living with  the grand parents"|rel_mother_q2_18_ot=="Mother separated with the father when he was very young"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="Grew up with the Aunt"|rel_mother_q2_18_ot=="The respondent wasn't living with the mother"|rel_mother_q2_18_ot=="She has never lived with her mother"|rel_mother_q2_18_ot=="Grew up with my aunt"|rel_mother_q2_18_ot=="She stopped living with the mother when she was three years"|rel_mother_q2_18_ot=="Stayed with grandmum"|rel_mother_q2_18_ot=="Grew up with the grandparents"|rel_mother_q2_18_ot=="Grew up with the brothers"          ~"Not living with the mother"  ,
																		rel_mother_q2_18_ot=="Grew up with out parents"|rel_mother_q2_18_ot=="Never saw mum"|rel_mother_q2_18_ot=="Grew up with grandmum"|rel_mother_q2_18_ot=="Grew up with her grandmum"|rel_mother_q2_18_ot=="The mom left when she was 2 years old"|rel_mother_q2_18_ot=="Stayed with step mum"|rel_mother_q2_18_ot=="All parents had divorced"|rel_mother_q2_18_ot=="Did not grow up with mother"|rel_mother_q2_18_ot=="Was staying with grand parents"|rel_mother_q2_18_ot=="Grew up with step mum"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="They died in the war. She never even met them"|rel_mother_q2_18_ot=="Mother was dead by then"|rel_mother_q2_18_ot=="Mother died when he was two months"|rel_mother_q2_18_ot=="She died while I was about 3 years"|rel_mother_q2_18_ot=="The mother died when the respondent is still young"|rel_mother_q2_18_ot=="The mother  of the respondent died when she was 10 years"          ~"Mother had died" ,
																		rel_mother_q2_18_ot=="Was married already"|rel_mother_q2_18_ot=="Grew up with a step mother"|rel_mother_q2_18_ot=="Grew up with father"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="Lost parents at early age"|rel_mother_q2_18_ot=="Lost the mother at age of 12"|rel_mother_q2_18_ot=="They died when she was young"|rel_mother_q2_18_ot=="Mum died while I was about 2 years"          ~"Mother had died" ,
																		rel_mother_q2_18_ot=="The respondent was not living with her mother she was living with her aunt"|rel_mother_q2_18_ot=="Was already married"|rel_mother_q2_18_ot=="Was raised by dad"|rel_mother_q2_18_ot=="Mom left when she was young"|rel_mother_q2_18_ot=="Parents were far"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="Lost the mother at an early age"|rel_mother_q2_18_ot=="They had died by then"|rel_mother_q2_18_ot=="Mother died when she was nine years"|rel_mother_q2_18_ot=="Parents died when he was a baby"|rel_mother_q2_18_ot=="Mother died when he was 6months"|rel_mother_q2_18_ot=="Mother died when he was 1 year old"|rel_mother_q2_18_ot=="Mother died when he was 14years old"|rel_mother_q2_18_ot=="Mum had passed on"          ~"Mother had died" ,
																		rel_mother_q2_18_ot=="His mum was divorced by then"|rel_mother_q2_18_ot=="She was only with the dad"|rel_mother_q2_18_ot=="The respondent stopped living with her mother when she was eight years"|rel_mother_q2_18_ot=="Was raised by his grandma"|rel_mother_q2_18_ot=="Mother left him when he was 4 months old"|rel_mother_q2_18_ot=="Was raised by his aunt"          ~"Not living with the mother" ,
																		rel_mother_q2_18_ot=="Mother died when he was 15years old"|rel_mother_q2_18_ot=="Mother died after birth"|rel_mother_q2_18_ot=="She died when i was 6 years"|rel_mother_q2_18_ot=="She passed on when he was just 3 yrs"|rel_mother_q2_18_ot=="He's an orphan"          ~"Mother had died" ,
																		rel_father_q2_19_ot=="Father was already dead"|rel_father_q2_19_ot=="Parents where dead by then"|rel_father_q2_19_ot=="Dad had died by that time"|rel_father_q2_19_ot=="Died"|rel_father_q2_19_ot=="The dad died"|rel_father_q2_19_ot=="Lost father when still young"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Father was dead"|rel_father_q2_19_ot=="Dad died"|rel_father_q2_19_ot=="Dad died while she I was young"|rel_father_q2_19_ot=="Had died"|rel_father_q2_19_ot=="Dad had passed on"|rel_father_q2_19_ot=="Parents had died"|rel_father_q2_19_ot=="The dad died when she was young"|rel_father_q2_19_ot=="The dad passed on"|rel_father_q2_19_ot=="Father was dead"|rel_father_q2_19_ot=="Father had died"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Lost the Father when still young"|rel_father_q2_19_ot=="Dad was dead by then"|rel_father_q2_19_ot=="Dad died when I was 7years old."|rel_father_q2_19_ot=="Father died when she was three years"          ~"Father had died" ,
																		rel_father_q2_19_ot=="The father died when i was too young"|rel_father_q2_19_ot=="Parents died when she was younger than 10years"|rel_father_q2_19_ot=="He also died when he was young"|rel_father_q2_19_ot=="He was dead"|rel_father_q2_19_ot=="Had passed on"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="Dad died when i was still a baby"|rel_father_q2_19_ot=="Didn't grow up with dad because hey had died"|rel_father_q2_19_ot=="He had died"|rel_father_q2_19_ot=="All parents had died"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="He died when she was an infant"|rel_father_q2_19_ot=="Died"          ~"Father had died" ,
																		rel_father_q2_19_ot=="He passed on"|rel_father_q2_19_ot=="Died at the age of 2"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Had lost the dad"|rel_father_q2_19_ot=="Dad died while young"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="Dad was had also died by that time"|rel_father_q2_19_ot=="He was dead by that time"          ~"Father had died" ,
																		rel_father_q2_19_ot=="The father died when she was too young"|rel_father_q2_19_ot=="Father died when he was 1 year old"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="Lost the Father at 6 years"|rel_father_q2_19_ot=="Lost the father at 13 years"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Dad died"|rel_father_q2_19_ot=="Died"|rel_father_q2_19_ot=="Dad died while I was younger"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="Father died"|rel_father_q2_19_ot=="Dad passed on when I was so young."|rel_father_q2_19_ot=="Died passed away when I was younger."|rel_father_q2_19_ot=="The dad past away when young"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Dad passed on"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="He passed away when  she was only 10"|rel_father_q2_19_ot=="Died"|rel_father_q2_19_ot=="he was dead by that time"|rel_father_q2_19_ot=="Died before she made 16"|rel_father_q2_19_ot=="Didn't grow up with the father. He died when he was young"|rel_father_q2_19_ot=="Dad passed away when I was younger."|rel_father_q2_19_ot=="Dad had also died by that time"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Died when still young"|rel_father_q2_19_ot=="Was dead"|rel_father_q2_19_ot=="Dad had died by that time"|rel_father_q2_19_ot=="Lost the father at the age of 2"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="Parents died when she was young"|rel_father_q2_19_ot=="Died"|rel_father_q2_19_ot=="Orphan"|rel_father_q2_19_ot=="Was dead"|rel_father_q2_19_ot=="Dad passed away when I was 10yrs"|rel_father_q2_19_ot=="Lost parent at age of 13"|rel_father_q2_19_ot=="Lost the father at age of 12"|rel_father_q2_19_ot=="Father had died"          ~"Father had died" ,
																		rel_father_q2_19_ot=="The respondent has never lived with the father because she died when she was too  young"|rel_father_q2_19_ot=="The father died when the respondent was too young"|rel_father_q2_19_ot=="Died"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Died"|rel_father_q2_19_ot=="Dad passed away when I was so 7years old"|rel_father_q2_19_ot=="My father passed away when I was 6 years."          ~"Father had died" ,
																		rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Died when he was young"|rel_father_q2_19_ot=="Had lost the dad"|rel_father_q2_19_ot=="Parents died when I was still young"|rel_father_q2_19_ot=="he was a ready dead"|rel_father_q2_19_ot=="Lost the dad"|rel_father_q2_19_ot=="Parents had died"|rel_father_q2_19_ot=="Father died while still young"|rel_father_q2_19_ot=="Died when she was very young"|rel_father_q2_19_ot=="Deceased"|rel_father_q2_19_ot=="Father died while still young"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Dad died when I was less than a year old."|rel_father_q2_19_ot=="My Dad passed on when I was a baby."|rel_father_q2_19_ot=="Dad passed away when I was younger."|rel_father_q2_19_ot=="He was dead"|rel_father_q2_19_ot=="Father had died"|rel_father_q2_19_ot=="All parents had died"|rel_father_q2_19_ot=="Dad died when she was 14"|rel_father_q2_19_ot=="Dad died when I was still young"|rel_father_q2_19_ot=="The dad passed on"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Lost the father at age 12"|rel_father_q2_19_ot=="Lost the father at the age of 4 months"|rel_father_q2_19_ot=="Passed away when I was so young."|rel_father_q2_19_ot=="He was dead"|rel_father_q2_19_ot=="Deceased"|rel_father_q2_19_ot=="Deceased"|rel_father_q2_19_ot=="Patents were dead by then"|rel_father_q2_19_ot=="Father died when he was 13years old"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Dad had passed on"|rel_father_q2_19_ot=="Lost the father at age of 3"|rel_father_q2_19_ot=="Lost the Father at age of 3"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Parents died when i was young"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Father died when she was 9 years"|rel_father_q2_19_ot=="Died"|rel_father_q2_19_ot=="Dad had died by that time"|rel_father_q2_19_ot=="Deceased"|rel_father_q2_19_ot=="He died before I knew him"|rel_father_q2_19_ot=="Had lost the dad"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="he was already dead"|rel_father_q2_19_ot=="He is an orphan"|rel_father_q2_19_ot=="Dad died early"|rel_father_q2_19_ot=="Dad had died"          ~"Father had died" ,
																		rel_father_q2_19_ot=="She wasn't living with her father"|rel_father_q2_19_ot=="Was not  Leaving with him"|rel_father_q2_19_ot=="Had a foster father"|rel_father_q2_19_ot=="Grow up with grand parents"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Was not with him"|rel_father_q2_19_ot=="Wasn't leaving with the father"|rel_father_q2_19_ot=="She wasn't living with her father"|rel_father_q2_19_ot=="Wasn't living with the father"|rel_father_q2_19_ot=="Didnot grow up with the father"|rel_father_q2_19_ot=="Never grew with dad"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="She wasn't living  with the father"|rel_father_q2_19_ot=="He was still very young never new"|rel_father_q2_19_ot=="Didn't grow up with the father"|rel_father_q2_19_ot=="She has never met the dad since birth"|rel_father_q2_19_ot=="Didn't grow up with my parents (was abandoned)"|rel_father_q2_19_ot=="She wasn't living the father,she was living with grand parents"|rel_father_q2_19_ot=="Didn't stay with father."|rel_father_q2_19_ot=="Grew up with mum only"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Father had divorced"|rel_father_q2_19_ot=="didn't get a chance to see dad"|rel_father_q2_19_ot=="Didn't grow up with the father"|rel_father_q2_19_ot=="Didn't grow with father"|rel_father_q2_19_ot=="Didn't grow up with the father"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Respondent stayed far from her fathers home from Childhood."|rel_father_q2_19_ot=="Was not with him"|rel_father_q2_19_ot=="Grew up with the brother"|rel_father_q2_19_ot=="She grew up with grand mum"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Didn't grow up with the father"|rel_father_q2_19_ot=="She did not grow up with her dad."|rel_father_q2_19_ot=="Never stayed with her father."|rel_father_q2_19_ot=="She does not know her father"|rel_father_q2_19_ot=="The respondent has never lived with her father"|rel_father_q2_19_ot=="The respondent wasn't living with the father"|rel_father_q2_19_ot=="Never leaved with the father"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Father had divorced"|rel_father_q2_19_ot=="Grew up with the grandmother"|rel_father_q2_19_ot=="Didn't grow with the father"|rel_father_q2_19_ot=="She has never met her dad ."|rel_father_q2_19_ot=="Raised by grandma"|rel_father_q2_19_ot=="Grow up with aunt"|rel_father_q2_19_ot=="Dad had divorced"|rel_father_q2_19_ot=="Was leaving with dad only"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Never been with dad"|rel_father_q2_19_ot=="The respondent has never lived with the father"|rel_father_q2_19_ot=="She did not grow up with the dad"|rel_father_q2_19_ot=="Didn't grow with the father"|rel_father_q2_19_ot=="Grew up with aunt"|rel_father_q2_19_ot=="Grew up with mum a lone"|rel_father_q2_19_ot=="The respondent stopped living with the father at the age of four years"|rel_father_q2_19_ot=="Never saw my dad"|rel_father_q2_19_ot=="Didn't grow with the father"|rel_father_q2_19_ot=="Didn't see her parents"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Father died when he was 6years old"|rel_father_q2_19_ot=="Father died when he was very young"|rel_father_q2_19_ot=="Father died when he was 7years old"|rel_father_q2_19_ot=="He died while she was about 9 years"|rel_father_q2_19_ot=="He died when I was about 10 years"|rel_father_q2_19_ot=="ad passed away when I was 7years."|rel_father_q2_19_ot=="He passed away when I was 3years old."|rel_father_q2_19_ot=="Dad passed away when I was 10years."|rel_father_q2_19_ot=="Dad also had died by that time"|rel_father_q2_19_ot=="Lost the father at age of 8 months"|rel_father_q2_19_ot==" Dad had died"|rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Dad passed away when I was 7years."          ~"Father had died" ,
																		rel_father_q2_19_ot=="Didn't grow with him"|rel_father_q2_19_ot=="Didn't grow up with him"|rel_father_q2_19_ot=="Grew up with the Aunt"|rel_father_q2_19_ot=="The respondent stopped living with the father when she was young  at 10 years"|rel_father_q2_19_ot=="Grew up with mum alone"|rel_father_q2_19_ot=="Grow up with my uncle"|rel_father_q2_19_ot=="Didn't live with him"|rel_father_q2_19_ot=="Grew up with grandfather"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Dad had died"|rel_father_q2_19_ot=="Dad had died "|rel_father_q2_19_ot=="Father died when he was 2years old"|rel_father_q2_19_ot=="Lost the father at age of 14"|rel_father_q2_19_ot=="He past away when his very young"|rel_father_q2_19_ot=="He had deid"|rel_father_q2_19_ot=="Father was dead by then"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Was raised by his aunt"|rel_father_q2_19_ot=="Was raised by mum Alone"|rel_father_q2_19_ot=="Grew up with my aunt"|rel_father_q2_19_ot=="Stayed with grand mum"|rel_father_q2_19_ot=="Grew up with the grandparents"|rel_father_q2_19_ot=="Grew up with the brothers"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Grew up with out parents"|rel_father_q2_19_ot=="Grew up with grandmother."|rel_father_q2_19_ot=="Lived with grandmum"|rel_father_q2_19_ot=="The respondent wasn't living with the father,she stopped living with him at the age of two years"|rel_father_q2_19_ot=="All parents had divorced"|rel_father_q2_19_ot=="Never raised by dad"|rel_father_q2_19_ot=="She only lived with the father when she was too young"|rel_father_q2_19_ot=="The father of the respondent died when she was still young"|rel_father_q2_19_ot=="Was staying with grand parents"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="She has no idea because he passed away when she was 1year"|rel_father_q2_19_ot=="He died when she was five years"|rel_father_q2_19_ot=="They fired in the war she never even met them"|rel_father_q2_19_ot=="He passed away when she was 2 years"|rel_father_q2_19_ot=="The father of the respondent died when she was 10 years"|rel_father_q2_19_ot=="Dad died when he was 13years"          ~"Father had died" ,
																		rel_father_q2_19_ot=="The respondent's father died when she was 5 years"|rel_father_q2_19_ot=="The father of the respondent died when she was  not yet born"|rel_father_q2_19_ot=="Passed away when i was a kid"|rel_father_q2_19_ot=="Died when he was still two years"|rel_father_q2_19_ot=="Dad had also died"|rel_father_q2_19_ot=="Father died when he was a baby"|rel_father_q2_19_ot=="Lost parent at an early age"|rel_father_q2_19_ot=="Lost the father at age of 9"|rel_father_q2_19_ot=="He died while I was about 8 years"|rel_father_q2_19_ot=="They died when she was young"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Grew up with stepmother"|rel_father_q2_19_ot=="Didn't grow up with dad"|rel_father_q2_19_ot=="Grow up with mum only"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="The respondent wasn't living with the father she was living with the aunt"|rel_father_q2_19_ot=="Never saw them"|rel_father_q2_19_ot=="Never met my dad"|rel_father_q2_19_ot=="Was already married"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="Parents were dead by then"|rel_father_q2_19_ot=="The respondent's father died  when she was too young at 4 years"|rel_father_q2_19_ot=="He had passed away"|rel_father_q2_19_ot=="Father died early"|rel_father_q2_19_ot=="Lost the Father at age of 1"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Grew up with only the mom"|rel_father_q2_19_ot=="Was married already"|rel_father_q2_19_ot=="The respondent stopped living with the father when she was ten years of age"|rel_father_q2_19_ot=="The respondent stopped living with her father when she was eight years"|rel_father_q2_19_ot=="Was married already"|rel_father_q2_19_ot=="Parents were far"|rel_father_q2_19_ot=="Was married already "|rel_father_q2_19_ot=="Never knew his father"|rel_father_q2_19_ot=="Didn't with the father"|rel_father_q2_19_ot=="Was raised by mum alone"|rel_father_q2_19_ot=="Raised by his aunt"|rel_father_q2_19_ot=="Raised by mum only"          ~"Not living with the father" ,
																		rel_father_q2_19_ot=="They had died by then"|rel_father_q2_19_ot=="He died while I was about 3 years"|rel_father_q2_19_ot=="Parents died when he was a baby"|rel_father_q2_19_ot=="He passed away when she was very young"|rel_father_q2_19_ot=="Father when he was not yet born"|rel_father_q2_19_ot=="His dad had passed on"|rel_father_q2_19_ot=="Father died when was so young"|rel_father_q2_19_ot=="Father died when he 15years old"          ~"Father had died" ,
																		rel_father_q2_19_ot=="Dad died while I was around 5 years"|rel_father_q2_19_ot=="Father died both he was born"|rel_father_q2_19_ot=="He died during the war"|rel_father_q2_19_ot=="Father died before he was born"|rel_father_q2_19_ot=="He's an orphan"|rel_father_q2_19_ot=="Father died when he was 8years old"|rel_father_q2_19_ot=="He died. Never saw him"|rel_father_q2_19_ot=="Passed on when he was young"          ~"Father had died",
																		TRUE ~ rel_mother_q2_18_ot) ,
		lang_q2_23 = case_when(lang_q2_23_ot=="Lunyarwanda"|lang_q2_23_ot=="Runyarwanda"          ~30 ,
													 lang_q2_23_ot=="Lusamya"          ~21 ,
													 lang_q2_23_ot=="Japadola"|lang_q2_23_ot=="Ludaama"          ~8 ,
													 lang_q2_23_ot=="Lululu"          ~28 ,
													 TRUE ~ as.numeric(lang_q2_23)),
		lang_q2_23_ot = case_when(lang_q2_23_ot=="Lunyara"|lang_q2_23_ot=="Luyala"          ~"Lunyala" ,
															lang_q2_23_ot=="Lukenye"          ~"Lukenyi" ,
															lang_q2_23_ot=="Lunyarwanda"|lang_q2_23_ot=="Runyarwanda"          ~"" ,
															lang_q2_23_ot=="Lusamya"          ~"" ,
															lang_q2_23_ot=="Japadola"|lang_q2_23_ot=="Ludaama"          ~"" ,
															lang_q2_23_ot=="Lululu"          ~"" ,
															lang_q2_23_ot=="Lugisu"          ~"Lugishu" ,
															TRUE ~ lang_q2_23_ot),
		q2_24_oth = case_when(q2_24_oth=="Arabia"          ~"Arabic" ,
													q2_24_oth=="Ludama"|q2_24_oth=="Ludaama"|q2_24_oth=="Rudama"          ~"" ,
													q2_24_oth=="Lugisu"|q2_24_oth=="Gishu"|q2_24_oth=="Rugisu"          ~"Lugishu" ,
													q2_24_oth=="Lukenye"|q2_24_oth=="lukenye"|q2_24_oth=="Rukenyi"|q2_24_oth=="Bakenyi"|q2_24_oth=="Olukenyi"|q2_24_oth=="Keni"          ~"Lukenyi" ,
													q2_24_oth=="Lululi"          ~"" ,
													q2_24_oth=="Lunyara"|q2_24_oth=="Lunyala"|q2_24_oth=="Runyala"          ~"Munyala" ,
													q2_24_oth=="Lunyarwanda"|q2_24_oth=="Runyarwanda"|q2_24_oth=="Lunyarwanda"          ~"" ,
													q2_24_oth=="Lunyoli"          ~"" ,
													q2_24_oth=="Lusamya"          ~"" ,
													q2_24_oth=="Rutanzania"          ~"Lutanzania" ,
													q2_24_oth=="Teso"          ~"" ,
													q2_24_oth=="Kiswahili"          ~"" ,
													q2_24_oth=="Tanzania"          ~"Lutanzania" ,
													q2_24_oth=="Lululi "          ~"" ,
													TRUE ~ q2_24_oth),
		other_lang_q2_24_1 = case_when(other_lang_q2_24_1==36 & (q2_24_oth=="Ludama"|q2_24_oth=="Ludaama"|q2_24_oth=="Rudama")          ~8 ,
																	 other_lang_q2_24_1==36 & (q2_24_oth=="Ludama"|q2_24_oth=="Ludaama")          ~8 ,
																	 other_lang_q2_24_1==36 & q2_24_oth=="Rudama"          ~8 ,
																	 other_lang_q2_24_1==36 & q2_24_oth=="Lululi"          ~28,
																	 TRUE ~ as.numeric(other_lang_q2_24_1)) ,
		q2_24_oth = case_when(other_lang_q2_24_1==36 & (q2_24_oth=="Lulundi"|q2_24_oth=="Lurundi"|q2_24_oth=="Rulundi"|q2_24_oth=="Rurundi.    He is a Burundi national"|q2_24_oth=="Rurundi")          ~"Mulundi" ,
													other_lang_q2_24_2==36 & q2_24_oth=="Rurundi"|q2_24_oth=="Lurundi"|q2_24_oth=="Murundi"          ~"Mulundi" ,
													TRUE ~ q2_24_oth),
		
		other_lang_q2_24_2 = case_when(other_lang_q2_24_2==36 & q2_24_oth=="Lunyarwanda"          ~30 ,
																	 other_lang_q2_24_2==36 & q2_24_oth=="Runyarwanda"          ~30 ,
																	 other_lang_q2_24_2==36 & q2_24_oth=="Lunyarwanda"          ~30 ,
																	 other_lang_q2_24_2==36 & q2_24_oth=="Lunyoli"          ~31 ,
																	 other_lang_q2_24_1==36 & q2_24_oth=="Lusamya"          ~21 ,
																	 q2_24_oth=="Teso"          ~7 ,
																	 q2_24_oth=="Kiswahili"          ~3 ,
																	 q2_24_oth=="Lululi "          ~28, 
																	 TRUE ~ as.numeric(other_lang_q2_24_2)) ,
		

		
		tribe_q2_25 = case_when(tribe_q2_25_ot=="Mulamoji"|tribe_q2_25_ot=="Mulamwogi"          ~19 ,
														tribe_q2_25_ot=="Murundi"          ~20 ,
														tribe_q2_25_ot=="Muteso"|tribe_q2_25_ot=="Muteeso"          ~6 ,
														tribe_q2_25_ot=="Akakwa"          ~28 ,
														tribe_q2_25_ot=="Munyarwanda"          ~22 ,
														tribe_q2_25_ot=="Munyala"|tribe_q2_25_ot=="Lunyara"          ~35 ,
														tribe_q2_25_ot=="Japadola"|tribe_q2_25_ot=="Mudama"|tribe_q2_25_ot=="Mudaama"|tribe_q2_25_ot=="mudama"|tribe_q2_25_ot=="Mudamma"          ~7 ,
														tribe_q2_25_ot=="None"          ~32 ,
														tribe_q2_25_ot=="Murundi"|tribe_q2_25_ot=="Mulundi"          ~34 ,
														tribe_q2_25_ot=="Mululu"|tribe_q2_25_ot=="Lululi"          ~20 ,
														tribe_q2_25_ot=="Mugishu"|tribe_q2_25_ot=="Gishu"          ~15 ,
														tribe_q2_25_ot=="Murugwaala"          ~12 ,
														tribe_q2_25_ot=="Luo"          ~4 ,
														TRUE ~ as.numeric(tribe_q2_25)),
		
		tribe_q2_25_ot = case_when(tribe_q2_25_ot=="Mutanzania"|tribe_q2_25_ot=="mutanzania"|tribe_q2_25_ot=="Tanzania"|tribe_q2_25_ot=="Shuubi(from Tanzania)"|tribe_q2_25_ot=="Baziba, tanzanian"|tribe_q2_25_ot=="Luziba from Tanzanian"|tribe_q2_25_ot=="Bahangazi from Tanzania"|tribe_q2_25_ot=="Tazanian"|tribe_q2_25_ot=="Bahangaza from Tanzania"|tribe_q2_25_ot=="Mutazania"|tribe_q2_25_ot=="Rutanzania"          ~"Tanzanian" ,
															 tribe_q2_25_ot=="Mulamoji"|tribe_q2_25_ot=="Mulamwogi"          ~"" ,
															 tribe_q2_25_ot=="Mukenye"|tribe_q2_25_ot=="Bakenyi"          ~"Mukenyi" ,
															 tribe_q2_25_ot=="Murundi"          ~"" ,
															 tribe_q2_25_ot=="Muteso"|tribe_q2_25_ot=="Muteeso"          ~"" ,
															 tribe_q2_25_ot=="Nubi"          ~"Munubi" ,
															 tribe_q2_25_ot=="Kuku sudanese"|tribe_q2_25_ot=="Mukuku"|tribe_q2_25_ot=="Kuku tribe sudanese"|tribe_q2_25_ot=="Kuku tribe"|tribe_q2_25_ot=="Musudan"|tribe_q2_25_ot=="sudanese"          ~"Sudanese" ,
															 tribe_q2_25_ot=="Akakwa"          ~"" ,
															 tribe_q2_25_ot=="Munyarwanda"          ~"" ,
															 tribe_q2_25_ot=="Munyala"|tribe_q2_25_ot=="Lunyara"          ~"" ,
															 tribe_q2_25_ot=="Japadola"|tribe_q2_25_ot=="Mudama"|tribe_q2_25_ot=="Mudaama"|tribe_q2_25_ot=="mudama"|tribe_q2_25_ot=="Mudamma"          ~"" ,
															 tribe_q2_25_ot=="None"          ~"" ,
															 tribe_q2_25_ot=="Japadola"          ~"" ,
															 tribe_q2_25_ot=="Murundi"|tribe_q2_25_ot=="Mulundi"          ~"" ,
															 tribe_q2_25_ot=="Mululu"|tribe_q2_25_ot=="Lululi"          ~"" ,
															 tribe_q2_25_ot=="Mugishu"|tribe_q2_25_ot=="Gishu"          ~"" ,
															 tribe_q2_25_ot=="Murugwaala"          ~"" ,
															 tribe_q2_25_ot=="Luo"          ~"", 
															 TRUE ~  tribe_q2_25_ot),
		
		activity_q3_1_ot = case_when(activity_q3_1_ot=="Bank"          ~"Banking" ,
																 activity_q3_1_ot=="Managing my bar"|activity_q3_1_ot=="bar"|activity_q3_1_ot=="bar attendant"          ~"Bar business" ,
																 activity_q3_1_ot=="Business"|activity_q3_1_ot=="Bussiness man"|activity_q3_1_ot=="Businessman in fishing"          ~"Businessman" ,
																 activity_q3_1_ot=="Carpenter"          ~"Carpentry" ,
																 activity_q3_1_ot=="Covering mud brick made by husband"|activity_q3_1_ot=="Covering already made mud bricks"          ~"Covering mud brick" ,
																 activity_q3_1_ot=="FiShing"|activity_q3_1_ot=="Fisher man"|activity_q3_1_ot=="Fishing"|activity_q3_1_ot=="Fisherman"          ~"Fishng" ,
																 activity_q3_1_ot=="Maize business"|activity_q3_1_ot=="Maize processor"          ~"Maize production" ,
																 activity_q3_1_ot=="Makes mats"|activity_q3_1_ot=="Making mats"|activity_q3_1_ot=="mat making"          ~"Mats making" ,
																 activity_q3_1_ot=="Mobile money"          ~"Mobile money services" ,
																 activity_q3_1_ot=="Nurse"|activity_q3_1_ot=="Medical Nurse"|activity_q3_1_ot=="She is a nurse at the health center"          ~"Nursing" ,
																 activity_q3_1_ot=="Pastor"          ~"Pastoring in church" ,
																 activity_q3_1_ot=="Salon"|activity_q3_1_ot=="Saloon"|activity_q3_1_ot=="Saloon services"|activity_q3_1_ot=="salon ogwa"|activity_q3_1_ot=="saloon"|activity_q3_1_ot=="He owns a saloon for hair dressing"          ~"Saloon" ,
																 activity_q3_1_ot=="Selling charcoal"|activity_q3_1_ot=="Selling fish"|activity_q3_1_ot=="Selling in a kiosik"|activity_q3_1_ot=="Sells clothes"|activity_q3_1_ot=="Sells fuel"|activity_q3_1_ot=="Sells fuel and tomatoes"|activity_q3_1_ot=="Sells meat"|activity_q3_1_ot=="Sells sauce only. Beef sauce."|activity_q3_1_ot=="Sells vegetables"|activity_q3_1_ot=="Sells tomatoes and Irish potatoes"|activity_q3_1_ot=="Sells water in twenty litre jerricansTrading food, selling and buying matooke"|activity_q3_1_ot=="selling petrol"|activity_q3_1_ot=="Sales vet medicine"          ~"Seller" ,
																 TRUE ~ activity_q3_1_ot),
		
		relig_q14_1_ot = case_when(relig_q14_1_ot=="Othodox"          ~"Orthodox" , 
															 TRUE ~ relig_q14_1_ot),
		dwell_q16_1 = case_when(dwell_q16_1_ot=="Renting alone and the other is a school"          ~2 , 
														TRUE ~ as.numeric(dwell_q16_1)),
		dwell_q16_1_ot = case_when(dwell_q16_1_ot=="Renting alone and the other is a school"          ~"" ,
															 TRUE ~ dwell_q16_1_ot),
		floor_q16_6_ot = case_when(floor_q16_6_ot=="Some have cement and others dont"|floor_q16_6_ot=="in some rooms there is cement while other rooms are not cemented"|floor_q16_6_ot=="some rooms are cemented others are not"          ~"Some have cement, some don't" ,
															 TRUE ~ floor_q16_6_ot),
		light_q16_7_ot = case_when(light_q16_7_ot=="A battery powered lamp"|light_q16_7_ot=="A lamp with batteries (torch like)"|light_q16_7_ot=="Battery"|light_q16_7_ot=="Battery powered  lights"|light_q16_7_ot=="Battery powered lights"|light_q16_7_ot=="Connects the bulb to a car battery."|light_q16_7_ot=="Bulbs connected to batteries"|light_q16_7_ot=="Taaala yamanda"          ~"Battery powered lamp" ,
															 light_q16_7_ot=="Candle"          ~"Candles" ,
															 light_q16_7_ot=="Bulb powered by dry cells"|light_q16_7_ot=="Dry cells lamp"|light_q16_7_ot=="Lamp of dry cells"|light_q16_7_ot=="Lamps of dry cells"|light_q16_7_ot=="They connect dry cells with the bulb"          ~"Dry cells lamp" ,
															 TRUE ~ light_q16_7_ot),
		fuel_q16_8_ot = case_when(fuel_q16_8_ot=="Both firewood and charcoal"|fuel_q16_8_ot=="charcoal and firewood"          ~"Both charcoal and firewood" ,
															fuel_q16_8_ot=="Eats from restaurants"| fuel_q16_8_ot=="Eats from resturant"|fuel_q16_8_ot=="He never cooks buys food"|fuel_q16_8_ot=="They don't cook"          ~"Doesn't cook" ,
															TRUE ~ fuel_q16_8_ot),
		kitchen_q16_10_ot = case_when(kitchen_q16_10_ot=="Eats from restaurants"|kitchen_q16_10_ot=="Has no kichen"|kitchen_q16_10_ot=="They don't cook"|kitchen_q16_10_ot=="Eats from arestaurant"          ~"Doesn't cook" ,
																	kitchen_q16_10_ot=="Shelter out side"|kitchen_q16_10_ot=="Outside in separate room"          ~"" ,
																	TRUE ~ kitchen_q16_10_ot),
		kitchen_q16_10 = case_when(kitchen_q16_10_ot=="Shelter out side"|kitchen_q16_10_ot=="Outside in separate room"          ~3 ,
															 TRUE ~ as.numeric(kitchen_q16_10)),
		water_q16_11_ot = case_when(water_q16_11_ot=="They buy mineral water from shops"|water_q16_11_ot=="Always take bottled water"          ~" Bottled water" ,
																water_q16_11_ot=="Kitoogo"          ~"Swamp"  ,
																TRUE ~ water_q16_11_ot),
		water_q16_11 = case_when(water_q16_11_ot=="Lake"          ~8 ,
														 TRUE ~ as.numeric(water_q16_11)),
		water_q16_11_ot = case_when(water_q16_11_ot=="Lake"|water_q16_11_ot=="Stream"          ~"" ,
																water_q16_11_ot=="New in the area but gets water from the borehole"|water_q16_11_ot=="Buy from a person who gets it from the bore hole"          ~"Well" ,
																TRUE ~ water_q16_11_ot),
		
		rel_q18_2_1 = case_when(rel_q18_2_10_ot=="A baby of 9months" & KEY=="uuid:98094d84-c182-45c9-a0a0-4f4160a82515"          ~2 ,
														rel_q18_2_10_ot=="A very young baby" & KEY=="uuid:c545a5ee-0720-4e38-bb81-9567827dc58a"          ~2 ,
														rel_q18_2_10_ot=="Kids" & KEY=="uuid:2da3e41e-061b-411b-a9d9-951e027f53c2"          ~2 ,
														rel_q18_2_10_ot=="A young baby" & KEY=="uuid:2b5fe583-afb6-47b2-bd49-63b801581e4a"          ~2 ,
														rel_q18_2_10_ot=="Grandson"| rel_q18_2_10_ot=="Grandchildren" & KEY=="uuid:84bbd5cb-216a-4cfe-981f-594b10ca6d00"|KEY=="uuid:3112bc4a-8992-4fb3-b4f6-0fcc53782a73"|KEY=="uuid:62fe4fdb-b613-4895-be68-3642575b70c9"|KEY=="uuid:a07f1cd1-40b5-491c-be49-a5d59171505f"          ~4 ,
														rel_q18_2_10_ot=="Husband" & KEY=="uuid:125cd136-5f0c-4a44-97da-74cb1782db2d"|KEY=="uuid:299b9605-30f9-400f-8e1d-91a16bbf3e06"          ~1 ,
														rel_q18_2_10_ot=="A sick young child of like 10  months" & KEY=="uuid:25c515cc-491c-49d1-aca4-fe9b21f58144"          ~1 ,
														rel_q18_2_10_ot=="Brothers"|rel_q18_2_10_ot=="Grandchildren"          ~4 ,
														TRUE ~ as.numeric(rel_q18_2_1)),
		
		rel_q18_2_2 = case_when(rel_q18_2_10_ot=="Husband was around the home" & KEY=="uuid:d9450bcb-ee76-4934-a405-65214c6543f7"          ~1 ,
														rel_q18_2_10_ot=="A baby who was feeding on the mother's breasts" & KEY=="uuid:4dc499ba-e026-4fb9-8651-dc4b215d6095"          ~1 ,
														rel_q18_2_10_ot=="A baby who was feeding on the mother's breasts" & KEY=="uuid:4dc499ba-e026-4fb9-8651-dc4b215d6095"          ~1 ,
														rel_q18_2_10_ot=="Two young grandchildren" & KEY=="uuid:6c7b25af-2569-4f33-9d02-6812ea81249b"          ~4 ,
														rel_q18_2_2==8 & (rel_q18_2_10_ot=="A baby of six months"|rel_q18_2_10_ot=="A young baby"| rel_q18_2_10_ot=="A young girl was cooking"|rel_q18_2_10_ot=="A young baby boy"|rel_q18_2_10_ot=="Neighbour's kids")          ~4 ,
														rel_q18_2_10_ot=="She was breastfeeding"          ~2 ,
														TRUE ~ rel_q18_2_2),
		
		rel_q18_2_10_ot = case_when(rel_q18_2_10_ot=="Grandson"| rel_q18_2_10_ot=="Grandchildren" & KEY=="uuid:84bbd5cb-216a-4cfe-981f-594b10ca6d00"|KEY=="uuid:3112bc4a-8992-4fb3-b4f6-0fcc53782a73"|KEY=="uuid:62fe4fdb-b613-4895-be68-3642575b70c9"|KEY=="uuid:a07f1cd1-40b5-491c-be49-a5d59171505f"          ~"" ,
																KEY=="uuid:c545a5ee-0720-4e38-bb81-9567827dc58a"          ~"" ,
																KEY=="uuid:98094d84-c182-45c9-a0a0-4f4160a82515"          ~"" ,
																KEY=="uuid:2da3e41e-061b-411b-a9d9-951e027f53c2"          ~"" ,
																KEY=="uuid:2b5fe583-afb6-47b2-bd49-63b801581e4a"          ~"" ,
																KEY=="uuid:d9450bcb-ee76-4934-a405-65214c6543f7"          ~"" ,
																KEY=="uuid:125cd136-5f0c-4a44-97da-74cb1782db2d"|KEY=="uuid:299b9605-30f9-400f-8e1d-91a16bbf3e06"          ~"" ,
																KEY=="uuid:25c515cc-491c-49d1-aca4-fe9b21f58144"|KEY=="uuid:4dc499ba-e026-4fb9-8651-dc4b215d6095"          ~"" ,
																KEY=="uuid:6c7b25af-2569-4f33-9d02-6812ea81249b"          ~"" ,
																(rel_q18_2_10_ot=="A baby of six months"|rel_q18_2_10_ot=="A young baby"|rel_q18_2_10_ot=="A young girl was cooking"|rel_q18_2_10_ot=="A young baby boy"|rel_q18_2_10_ot=="Neighbour's kids")          ~"" ,
																rel_q18_2_10_ot=="She was breastfeeding"          ~"" ,
																rel_q18_2_10_ot=="Brothers"|rel_q18_2_10_ot=="Grandchildren"          ~"" ,
																rel_q18_2_10_ot=="Client"          ~"Customers" ,
																TRUE ~ rel_q18_2_10_ot),
		
		county = case_when(county==1 & KEY=="uuid:98094d84-c182-45c9-a0a0-4f4160a82515"          ~4,
											 TRUE ~ as.numeric(county)),
		
		subcounty = case_when(subcounty==1 & KEY=="uuid:af86b3b2-061f-462e-b547-dc654220449b"|KEY=="uuid:9d83bdd4-f2ac-4216-b394-ded616dd02f3"          ~3 ,
													subcounty==1 & KEY=="uuid:d8b4bc9b-dac8-4c1b-b9b9-60bd4799e50b"|KEY=="uuid:2ab004d2-7a95-46f2-8b18-540e27af4daa"          ~3 ,
													subcounty==20 & KEY=="uuid:590597da-8a6e-4741-adeb-0974be3ae3e6"          ~22 ,
													subcounty==1 & KEY=="uuid:98094d84-c182-45c9-a0a0-4f4160a82515"          ~22 ,
													subcounty==7 & KEY=="uuid:4cd476ff-83af-4bd0-b972-12fb7e2e6c45"          ~2 ,
													subcounty==22 & KEY=="uuid:bde23f14-66c4-4fbc-9432-64faa573dd99"          ~21 ,
													subcounty==12 & KEY=="uuid:07a7050c-2bd6-4553-9471-c1ff7088a768"          ~9 ,
													TRUE ~ as.numeric(subcounty)),
		
		parish = case_when(parish==1 & KEY=="uuid:af86b3b2-061f-462e-b547-dc654220449b"          ~6 ,
											 parish==1 & KEY=="uuid:9d83bdd4-f2ac-4216-b394-ded616dd02f3"|KEY=="uuid:d8b4bc9b-dac8-4c1b-b9b9-60bd4799e50b"          ~5 ,
											 parish==1 & KEY=="uuid:d8b4bc9b-dac8-4c1b-b9b9-60bd4799e50b"|KEY=="uuid:2ab004d2-7a95-46f2-8b18-540e27af4daa"          ~5 ,
											 parish==45 & KEY=="uuid:590597da-8a6e-4741-adeb-0974be3ae3e6"          ~51 ,
											 parish==1 & KEY=="uuid:98094d84-c182-45c9-a0a0-4f4160a82515"          ~51 ,
											 parish==2 & KEY=="uuid:cbc44b7c-2a8d-43bb-8656-fd00b7f1f7e8"          ~4 ,
											 parish==28 & KEY=="uuid:bde23f14-66c4-4fbc-9432-64faa573dd99"          ~49 ,
											 parish==49 & KEY=="uuid:8a4e4dc6-6822-4739-b489-419683ca8b64"          ~48 ,
											 parish==7 & KEY=="uuid:4cd476ff-83af-4bd0-b972-12fb7e2e6c45"|KEY=="uuid:137b3212-cd73-4db6-a254-5509e9f1026b"|KEY=="uuid:a2de3e9f-598b-4e22-bf82-304ed6a9e6e9"|KEY=="uuid:c43053e5-738e-4776-aed5-8b1a789f26c1"|KEY=="uuid:dca4fef7-7027-40e7-86a6-876be34e26c8"          ~7 ,
											 parish==28 & KEY=="uuid:059afa9e-11f4-42de-bfbe-78273cec6596"          ~46 ,
											 parish==46 & KEY=="uuid:d485a34c-2c6a-4e73-8258-fbf69449dc55"          ~47  ,
											 parish==28 & KEY=="uuid:26325ce2-5cc2-48e9-98be-ae2e429d2890"          ~25 ,
											 parish==28 & KEY=="uuid:07a7050c-2bd6-4553-9471-c1ff7088a768"          ~26 ,
											 parish==28 & KEY=="uuid:501e748b-6b9e-4bee-a105-a41b41477ee3"          ~31 ,
											 parish==38 & KEY=="uuid:29a3a29e-8c5d-4f08-ac38-95b3ec886764"          ~39 ,
											 TRUE ~ as.numeric(parish)),
		
		parish_2 = case_when(KEY=="uuid:059afa9e-11f4-42de-bfbe-78273cec6596"|KEY=="uuid:26325ce2-5cc2-48e9-98be-ae2e429d2890"          ~"" ,
												 KEY=="uuid:501e748b-6b9e-4bee-a105-a41b41477ee3"          ~"" ,
												 KEY=="uuid:07a7050c-2bd6-4553-9471-c1ff7088a768"          ~"" ,
												 KEY=="uuid:bde23f14-66c4-4fbc-9432-64faa573dd99"          ~"" ,
												 TRUE ~ parish_2),
		tc = case_when(tc==1 & KEY=="uuid:af86b3b2-061f-462e-b547-dc654220449b"          ~6 ,
									 tc==1 & KEY=="uuid:9d83bdd4-f2ac-4216-b394-ded616dd02f3"|KEY=="uuid:d8b4bc9b-dac8-4c1b-b9b9-60bd4799e50b"          ~5 ,
									 tc==29 & KEY=="uuid:2ab004d2-7a95-46f2-8b18-540e27af4daa"          ~5 ,
									 tc==42 & KEY=="uuid:590597da-8a6e-4741-adeb-0974be3ae3e6"          ~32 ,
									 tc==1 & KEY=="uuid:98094d84-c182-45c9-a0a0-4f4160a82515"          ~32 ,
									 tc==2 & KEY=="uuid:cbc44b7c-2a8d-43bb-8656-fd00b7f1f7e8"          ~4 ,
									 tc==29 & KEY=="uuid:bde23f14-66c4-4fbc-9432-64faa573dd99"          ~31 ,
									 tc==29 & KEY=="uuid:8a4e4dc6-6822-4739-b489-419683ca8b64"          ~40 ,
									 tc==29 & KEY=="uuid:059afa9e-11f4-42de-bfbe-78273cec6596"          ~51 ,
									 tc==51 & KEY=="uuid:d485a34c-2c6a-4e73-8258-fbf69449dc55"          ~52 ,
									 tc==29 & KEY=="uuid:26325ce2-5cc2-48e9-98be-ae2e429d2890"          ~26 ,
									 tc==29 & KEY=="uuid:096ead21-19bc-4cbb-a2bd-60f6abef27b8"          ~24 ,
									 tc==2 & KEY=="uuid:4cd476ff-83af-4bd0-b972-12fb7e2e6c45"|KEY=="uuid:137b3212-cd73-4db6-a254-5509e9f1026b"|KEY=="uuid:a2de3e9f-598b-4e22-bf82-304ed6a9e6e9"|KEY=="uuid:c43053e5-738e-4776-aed5-8b1a789f26c1"|KEY=="uuid:dca4fef7-7027-40e7-86a6-876be34e26c8"          ~7 ,
									 tc==38 & KEY=="uuid:236a80c4-e588-4944-a453-e25916b77920"          ~20 ,
									 tc==20 & KEY=="uuid:6cd193db-bdd2-40bf-8951-5797d0c70272"          ~38 ,
									 tc==29 & KEY=="uuid:07a7050c-2bd6-4553-9471-c1ff7088a768"          ~27 ,
									 tc==29 & KEY=="uuid:501e748b-6b9e-4bee-a105-a41b41477ee3"          ~55 ,
									 tc==29 & KEY=="uuid:006dcc6d-4ead-4ddb-be2f-76fe3d0eb051"          ~36 ,
									 tc==50 & KEY=="uuid:29a3a29e-8c5d-4f08-ac38-95b3ec886764"          ~36 ,
									 tc==11 & KEY=="uuid:6368545a-33a1-4692-b28d-5045effb7717"          ~18 ,
									 tc==29 & KEY=="uuid:ee59245f-72c0-4f86-9aa1-bbdc259b2535"          ~17 ,
									 tc==29 & KEY=="uuid:3fddc21a-0768-4fec-92bd-d31b76af8f02"|KEY=="uuid:2cf15e22-6522-4f0c-9a37-97b2b8bf5bf3"|KEY=="uuid:59612085-206c-4465-ad1f-558becfd0090"          ~46 ,
									 TRUE ~ as.numeric(tc)),
		
		tc_2 = case_when(KEY=="uuid:bde23f14-66c4-4fbc-9432-64faa573dd99"          ~"" ,
										 KEY=="uuid:8a4e4dc6-6822-4739-b489-419683ca8b64"          ~"" ,
										 KEY=="uuid:26325ce2-5cc2-48e9-98be-ae2e429d2890"          ~"" ,
										 KEY=="uuid:096ead21-19bc-4cbb-a2bd-60f6abef27b8"          ~"" ,
										 KEY=="uuid:236a80c4-e588-4944-a453-e25916b77920"          ~"" ,
										 KEY=="uuid:6cd193db-bdd2-40bf-8951-5797d0c70272"          ~"" ,
										 KEY=="uuid:07a7050c-2bd6-4553-9471-c1ff7088a768"          ~"" ,
										 KEY=="uuid:501e748b-6b9e-4bee-a105-a41b41477ee3"          ~"" ,
										 KEY=="uuid:006dcc6d-4ead-4ddb-be2f-76fe3d0eb051"          ~"" ,
										 KEY=="uuid:2ab004d2-7a95-46f2-8b18-540e27af4daa"|KEY=="uuid:059afa9e-11f4-42de-bfbe-78273cec6596"          ~"" ,
										 TRUE ~ tc_2),
		village = case_when(KEY=="uuid:29a3a29e-8c5d-4f08-ac38-95b3ec886764"          ~"Bulami" ,
												TRUE ~ village),
		elections = case_when(KEY=="uuid:4740aeaf-54be-4dbb-9748-a5b1eb8d2a2b"|KEY=="uuid:b9c929d6-3e38-4274-930f-8e87b13ce3fa"| KEY=="uuid:1fab379e-3998-437f-86cc-f1cbff49e973"|KEY=="uuid:f5f0207f-0b00-4d5b-9af9-ba915d23f855"          ~2 ,
													KEY=="uuid:52c1ecb0-664a-4b2e-a43c-9e0e82ebedbc"|KEY=="uuid:2646682f-916f-402d-990c-e257b4fc323e"| KEY=="uuid:3f2a330c-3522-424e-93ec-83935f0baa78"          ~2 ,
													TRUE ~ as.numeric(elections)),
		tracking = case_when(tracking==0          ~1 ,
												 tracking==4 & KEY=="uuid:2e90cf22-7d50-4c82-ae04-542ebde253d9"          ~1 ,
												 tracking==5 & KEY=="uuid:2e90cf22-7d50-4c82-ae04-542ebde253d9"          ~1 ,
												 tracking==3 & KEY=="uuid:20a5cc3d-14d6-42c0-a114-a144bc8c5484"|KEY=="uuid:9107ea09-1d1a-4549-b59a-70c003fa4ad2"|KEY=="uuid:b4a4ca87-8518-4e24-9d2a-842d9be5118d"|KEY=="uuid:1bb52eca-0d41-4e64-ac8f-b3a523b97dcd"|KEY=="uuid:bcf7130a-900b-4182-88d5-501c867ef1b9"|KEY=="uuid:2da3e41e-061b-411b-a9d9-951e027f53c2"          ~1 ,
												 tracking==2 & (enum != 31&enum != 27&enum != 32)          ~1 ,
												 tracking==5 & KEY=="uuid:cf65a015-ebef-43f6-b74f-5db338b52dad"          ~1 ,
												 tracking==3 & KEY=="uuid:b9b84c30-1b8e-43a1-a6d5-9f08ab2a3ce4"|KEY=="uuid:e50b6b4b-7c3b-4384-9edb-407e31b5284c"          ~1 ,
												 tracking==4 & KEY=="uuid:6c83664c-6e17-41ab-8234-af91f5bd8188"          ~1 ,
												 TRUE ~ as.numeric(tracking)),
		# ** Generating a FLAG variable for mobilization through neighbors
		# gen mob_neigh_possible=.
		# replace mob_neigh_possible=1 if tc==5|tc==6|tc==32|tc==33|tc==57
		mob_neigh_possible = ifelse((tc==5|tc==6|tc==32|tc==33|tc==57), 1, 0),
		# gen mob_neigh=.
		# replace mob_neigh=1 if id==113122|id==113112|id==113201|id==126237|id==126205|id==126224|id==126231|id==126225|id==126136|id==126133
		mob_neigh = ifelse(id==113122|id==113112|id==113201|id==126237|id==126205|id==126224|id==126231|id==126225|id==126136|id==126133, 1, 0),
		# ** Generating a dummy variable to indicate people interviewed during the second round (low-compliance tc)
		# gen resample=.
		# forval i=51(1)70{
		# replace resample=1 if id==1171`i'|id==1132`i'| id==1133`i'|  id==1252`i'|  id==1262`i'|  id==2123`i'|id==2134`i'|  id==2141`i'| id==2173`i'| id==2142`i'| id==2145`i'| id==3141`i'| id==3161`i'| id==3122`i'
		# }
		resample = ifelse(
			id %in% outer(X = list(1171,1132,1133,1252,1262,2123,2134,2141,2173,2142,2145,3141,3161,3122),
										Y = 51:70, 
										FUN = paste0), 
			yes = 1, no = 0) 
	)


el_pilot$tc_id <- el_pilot$tc
